#ifndef FUDP_CLIENT
#define FUDP_CLIENT

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "../../Configure/header/common_conf.hpp"


class fudpClient
{
private:
    // the soket
    int fd;
    // the target
    struct sockaddr_in dst_address;

    const char* dst_ip;

    // the last unack packet
    int sendBase;
    // the next packet to send
    int nextSeqNum;

    // the buffer
    

    fudpClient(){}

    void handleHandshake(const char* method,const char* filename);

    void handleSend();

    void handleGet();

    void handleClose();

    int initSocket(int port);

public:
    // init a client connect to server with the server's ip
    fudpClient(const char* ip);

    bool lsend(const char* filename);

    bool lget(const char* filename);
};

#endif
